<template>
  <div class=" board-console-header">
    <div class="visual-header">
      <div class="visual-header-center">
        <span>{{ screenOptions.title }}</span>
      </div>
      <div class="visual-header-right ">
        <div class="visual-header-action">
          预览
        </div>
        <div class="visual-header-action" @click="screenConfig()">
          大屏设置
        </div>
      </div>
    </div>
    <config v-show="showScreenConfig" class="screen-config" />
  </div>
</template>
<script>
import Config from './Config'
import { mapState, mapMutations } from 'vuex'
export default {
  name: 'Header',
  components: { Config },
  data() {
    return {}
  },
  computed: {
    ...mapState({
      showScreenConfig: state => state.screen.screenOptions.showScreenConfig,
      screenOptions: state => state.screen.screenOptions
    })
  },
  methods: {
    screenConfig() {
      const showScreenConfig = !this.showScreenConfig
      this._updateShowScreenConfig(showScreenConfig)
    },
    ...mapMutations({
      _updateShowScreenConfig: 'screen/_updateShowScreenConfig'
    })
  }
}
</script>
<style lang="scss" scoped>
// header高度
$headeHeight: 48px;
// left宽度
$leftNavWidth: 84px;

.screen-config {
  position: fixed;
  width: 266px;
  min-height: 120px;
  right: 0px;
  z-index: 10001;
  top: $headeHeight;
  box-sizing: border-box;
  background: rgb(32, 32, 32);
  padding: 16px;
}

.board-console-header {
  height: $headeHeight;
  width: 100%;
  z-index: 1;
}
.visual-header {
  position: relative;
  height: $headeHeight;
  padding-right: 130px;
  background: #2e2e2e;
}
.visual-header .visual-header-center {
  height: $headeHeight;
  line-height: $headeHeight;
  text-align: center;
  font-size: 14px;
  position: relative;
  margin: auto;
}
.visual-header .visual-header-right {
  position: absolute;
  top: 0;
  right: 10px;
  height: $headeHeight;
  line-height: $headeHeight;
  padding: 0 10px;
}
.visual-header .visual-header-action {
  display: inline-block;
  cursor: pointer;
  margin: 0 6px;
  font-size: 12px;
}
.visual-header .visual-header-action:hover {
  opacity: 0.8;
}
</style>
